import { S } from '../../s';
import { IPSAppDEUILogic } from '../../app/dataentity/ipsapp-deuilogic';
import { IPSDEUILogic } from './ipsdeuilogic';
import { IPSDEUILogicNode } from './ipsdeuilogic-node';
import { IPSDEUILogicParam } from './ipsdeuilogic-param';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSDEUILogicImpl
  extends PSModelObjectImpl
  implements IPSDEUILogic, IPSAppDEUILogic
{
  get codeName(): string {
    return this.M.codeName;
  }

  get defaultParamName(): string {
    return this.M.defaultParamName;
  }

  get logicName(): string {
    return this.M.logicName;
  }

  protected psdeuilogicnodes: IPSDEUILogicNode[];
  getPSDEUILogicNodes(): IPSDEUILogicNode[] | null {
    return (
      this.psdeuilogicnodes ||
      (this.psdeuilogicnodes = this.fillChildListModel(
        this.M.getPSDEUILogicNodes,
        S._1ea,
      ) as IPSDEUILogicNode[])
    );
  }

  findPSDEUILogicNode(objKey: any): IPSDEUILogicNode | null {
    return this.getPSModel5(
      S._1ea,
      this.getPSDEUILogicNodes(),
      objKey,
    ) as IPSDEUILogicNode;
  }

  protected psdeuilogicparams: IPSDEUILogicParam[];
  getPSDEUILogicParams(): IPSDEUILogicParam[] | null {
    return (
      this.psdeuilogicparams ||
      (this.psdeuilogicparams = this.fillChildListModel(
        this.M.getPSDEUILogicParams,
        S._1f1,
      ) as IPSDEUILogicParam[])
    );
  }

  findPSDEUILogicParam(objKey: any): IPSDEUILogicParam | null {
    return this.getPSModel5(
      S._1f1,
      this.getPSDEUILogicParams(),
      objKey,
    ) as IPSDEUILogicParam;
  }

  protected startpsdeuilogicnode: IPSDEUILogicNode;
  getStartPSDEUILogicNode(): IPSDEUILogicNode | null {
    if (this.startpsdeuilogicnode != null) return this.startpsdeuilogicnode;
    const value = this.M.getStartPSDEUILogicNode;
    if (value == null) {
      return;
    }
    this.startpsdeuilogicnode = this.findPSDEUILogicNode(value);
    return this.startpsdeuilogicnode;
  }
  get cls(): string {
    return 'PSDEUILogicImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._205 || cls == S._206) return true;
    return super.instanceof(cls);
  }
}
